﻿#include "IniFile.h"
#include "StdioFileEx.h"
#include "obj.h"
#include <map>
#include "InitConfig.h"
using namespace std;

#define ConfigFile  _T(".//Config.ini")
#define AccountFile _T(".//Account.ini")
extern dmsoft * g_dm;
extern dmsoft * g_ckdm;

extern CIniFile g_IniFile;
extern CIniFile g_AccountFile;
extern CString arrState[];
extern CString g_TaskName;
extern CString g_Task;
extern bool bTaskFlag;
unsigned WINAPI TaskJinHaiAn(PVOID pParam);
unsigned WINAPI CheckTaskJinHaiAn(PVOID pParam);
unsigned WINAPI TaskLieNaHaiXia(PVOID pParam);
unsigned WINAPI SubTaskThread(PVOID pParam);
unsigned WINAPI MainTaskThread(PVOID pParam);
void RunTaskJin(CString strMapName);
void RunTask(CString str_TaskName, int n_XPath, CString str_Path, bool b_Flag);
extern map<CString, OcrInfo>ocrMap;
bool movetoX(long nTagX);
bool moveToY(long nTagX);
bool moveX(long nTagX);
bool moveToYEx(long nTagY, CString strMap);
bool MoveToMap(long nTagX,CString strMap);

bool movetoXY(long x);
bool movetoX(long nTagX, CString &taskNam);
bool MoveToMapEx(CString path);
bool movetoEX(CString path);
bool moveEX(long nTagX);
//bool moveEX1(long nTagX);
bool movetoX1(long nTagX);
void StringSplit(CString source, CStringArray& dest, char division);

DWORD RandomNumber(DWORD dwNumber1, DWORD dwNumber2);
void KillProcess(CString sExeName);
CString NumberToString(LONG Number);
int SplitVARIANT(CString strSrc, VARIANT* nlist, CString division);

void dmClick(OcrInfo ocrInfo);
void dmDoubleClick(OcrInfo ocrInfo);
bool runScript(CString str);
bool FindCol(OcrInfo ocrInfo);
bool FindMulCol(OcrInfo ocrInfo);
bool CmpCol(OcrInfo ocrInfo);
bool FindPic(OcrInfo ocrInfo);
bool FindStr(OcrInfo ocrInfo);
bool FindColBlock(OcrInfo ocrInfo);
bool runScriptList( CString str);
void taskOk();
void taskNext();
void Next();
void npcClick(CString strNpc, long x1, long y1);
void closeWndTask();
void clickNpcAll();
void moveGong(CString strKey);
void moveGong();
void JumpGong();
void JumpGong(bool bJump);
void moveRandGong();


